package com.videoweb.mapper;

import com.videoweb.entity.Favorites;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.videoweb.entity.vo.FavoritesVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author lmr
 * @since 2025-05-17
 */
@Mapper
public interface FavoritesMapper extends BaseMapper<Favorites> {

    @Select("SELECT f.id, f.user_id, f.`name`, f.is_public " +
            "FROM favorites f " +
            "JOIN video_favorite vf ON vf.favorites_id = f.id " +
            "WHERE vf.video_id = #{videoId} AND vf.user_id = #{userId}")
    public List<FavoritesVo> checkVideoFavorites(@Param("videoId") Long videoId, @Param("userId") Long userId);
}
